-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow for discriminating between beta and stable when building releases on Buildkite #17893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for discriminating between beta and stable when building releases on Buildkite #17893
Conversation
This will also make the addition of a parameter to differentiate between beta and stable builds cleaner.
We'll add another one next, and the line length would have gotten too long
After adding a parameter to the `release-build-wordpress.sh` call, I got a permission denied error. See https://buildkite.com/automattic/wordpress-ios/builds/4907#226a7e18-7592-4e95-9064-2829b4cb7f12/381-383 I guess if the path to a script is the only value in the `command` node, then Buildkite calls it via `sh` (or maybe `$SHELL`), otherwise it runs it as an actual command within its shell, in which case if the script is not executable, it fails.
bundle exec fastlane build_and_upload_app_store_connect \ | ||
skip_confirm:true \ | ||
create_gh_release:true \ | ||
beta_release:${1:-true} # use first call param, default to true for safety |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative could be to make $1
required and check for it at the start of the script.
This seemed more concise, and I didn't feel we needed refined input validation given these scripts are only meant to run via CI.
lane :build_and_upload_stable_release do |options| | ||
build_and_upload_app_store_connect(options) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These above were just unused lanes from the CircleCI implementation that I noticed while looking around the file.
branch: options[:branch_to_build], | ||
pipeline_file: 'release-builds.yml' | ||
) | ||
trigger_buildkite_release_build(branch: options[:branch_to_build], beta: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also considered ditching the two lanes for a single one with a beta
parameter. I decided to keep them because it can happen to have to start one such build from the terminal and in that case it's handy to have dedicated lanes and tab complete between the two.
# gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit', branch: 'trunk' | ||
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 2.3' | ||
gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit', branch: 'trunk' | ||
# gem 'fastlane-plugin-wpmreleasetoolkit', '~> 2.3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before merging this (or #17891) we ought to ship a new version of the release toolkit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v3.0.0 (wordpress-mobile/release-toolkit#334) is almost ready to go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's land this, then update #17891 to use the new version of the toolkit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM 👍
Thanks for handling this Gio!! |
This builds on top of #17891 to address the beta vs stable issue that I didn't notice in previous code reviews. See #17891 (review).
The "Rationale" section below is quite verbose. The code should explain itself, but I thought of adding it for extra details. Before diving into it, I'll drop the testing details.
To Test
The difference between beta and stable is in generating GitHub releases, which can happen only if the ASC submission succeeds. But the ASC submission cannot succeed unless we change the build number, and we don't want to do that.
That's to say, the only way to be 100% sure this work is to run it "for real", after it's been merged.
I attempted to test it as far as it would go by hacking the build in a way to verify my changes behaved as planned. See details in #17892.
Rationale
Before explaining my approach, here's some context on how release builds work on Buildkite. It's actually pretty similar to how they worked on CircleCI, but worth stating here:
complete_code_freeze
orfinalize_release
...trigger_beta_build
ortrigger_release_build
...buildkite_trigger_build
to run the pipeline described inrelease-builds.yml
The option I chose to differentiate between a beta release and a stable one was to call Buildkite with environment variable that is then converted to a call parameter for the command script, which in turn converts it into the appropriate
beta_release:true|false
for the build.The other option I though of was to had two pipeline files for beta and stable, and have
trigger_(beta|release)_build
call the appropriate one. I decided against this option because it would have resulted in too much duplication. Besides it would have either still used the script parameter converted tobeta_release
argument option from the current implementation, or have even more duplication with a dedicated command script for the beta release.You might also notice that I edited only the WordPress step, not the Jetpack one. That's because the only current effect of differentiating between beta and stable is in the resulting GitHub release being a pre-release or not. Since only the WordPress step generates the GitHub release, there was no need for the Jetpack one to change, too. Besides, the Jetpack build lane doesn't even expect a beta parameter:
WordPress-iOS/fastlane/Jetpack-Fastfile
Lines 90 to 118 in 9fc374b
Regression Notes
Potential unintended areas of impact
N.A.
What I did to test those areas of impact (or what existing automated tests I relied on)
N.A.
What automated tests I added (or what prevented me from doing so)
N.A.
RELEASE-NOTES.txt
if necessary. N.A.